<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <b>1</b>
    <b>2</b>
    <b>3</b>
    <div>1</div>
    <div>2</div>
    <div>3</div>

    <script src = "./jquery.min.js"></script>
    <script>
        var arr = ["red","green","blue"];
        $("b").each(function (index,domEle) {
            console.log(index); //获取的是每个元素的索引
            console.log(domEle); //获取的是DOM对象
            $(domEle).css("color",arr[index]);
        })

        // $.each() 可以遍历任何对象,通常用于处理数据
        $.each($("div"),function(i,ele) {
            console.log(i);
            console.log(ele);
            $(ele).css("color",arr[i]);
        })
    </script>
</body>
</html>